package java_thinking.unit_11._11_10;

import java.util.HashMap;
import java.util.Map;
import java.util.Random;

/**
 * @Description : 测试Random产生的数字的次数并放入Map中
 * @author: cww
 * @DateTime: 2019-03-17 22:57
 */

public class MapTest {
    public static void main(String[] args) {
        Map<Integer,Integer> integerMap = new HashMap<>();
        Random random = new Random(47);
        for (int i =0;i<10000;i++){
            int ra = random.nextInt(30);
            Integer q = integerMap.get(ra);
            integerMap.put(ra,q==null?1:q+1);
        }
        System.out.println(integerMap);
    }
}
